﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Linq;
using System.Collections.ObjectModel;
using MyDMS.DAL;

public partial class admin_Setup : System.Web.UI.Page
{
    private MyDMSEntity _myDmsEntity=new MyDMSEntity();
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Office office = new Office();
        office.Office_Name = txtOfcName.Text;

        string filePath = Server.MapPath("~/Upload/Logos/") + fluLogo.FileName;
        fluLogo.SaveAs(filePath);

        office.Office_Logo_Path = filePath;
        office.Office_Slogan = txtSlogan.Text;
        office.Street_Address = txtAddress.Text;
        office.City = txtCity.Text;
        office.Country = txtCountry.Text;
        office.Account_Email = txtEmail.Text;
        office.Account_Password = txtPass1.Text;

        office.Creation_Date = DateTime.Now;
        office.Updation_Date = DateTime.Now;

        _myDmsEntity.Office.AddObject(office);

        if (_myDmsEntity.SaveChanges()>0)
        {
            lblMessage.Text = "Saved Successfully";
        }
        else
        {
            lblMessage.Text = "Error!";
        }
        lblMessage.Visible = true;
    }
}
